---
description: "Swift documentation for 'max'"
layout: "default"
keywords: ""
title: "max"
root: "/v5.1"
---

<div class="intro-declaration"><code class="language-swift">func max(_:_:)(_ x: T, _ y: T) -> T</code></div><div class="discussion comment"><p>Returns the greater of two comparable values.
</p>
</div><div class="intro-declaration"><code class="language-swift">func max(_:_:_:_:)(_ x: T, _ y: T, _ z: T, _ rest: T) -> T</code></div><div class="discussion comment"><p>Returns the greatest argument passed.
</p>
</div>